//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Drawing;

namespace OpenLS.Chart
{
    internal sealed class ShapeHelper : IShapeReader
    {
        #region IShapeReader Members

        public IAnchored ReadContent(ReadContext context)
        {
            switch (context.ReaderLocalName)
            {
                case null:
                    return null;
                case "graphicFrame":
                    return context.ReadElement<GraphicFrame>();
                case "pic":
                    return context.ReadElement<Picture>();
                case "sp":
                    return context.ReadElement<Shape>();
                case "grpSp":
                    return context.ReadElement<GroupShape>();
                case "cxnSp":
                    return context.ReadElement<Connector>();
                default:
                    throw new NotSupportedException();
            }
        }

        #endregion
    }
}